﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace YArchitech.HVAC
{
	public partial class DuctEquipmentCoilParametersForm : System.Windows.Forms.Form
	{
		public DuctEquipmentCoilParametersForm()
		{
			this.InitializeComponent();
		}

		public DuctEquipmentCoilParametersForm(EquipmentCoilSetDetailParas equipmentCoilSetDetailParas)
		{
			this.InitializeComponent();
			//base.Icon = Resource.YArchitechIcon;
			this.equipmentCoilSetDetailParas = equipmentCoilSetDetailParas;
		}

		private void DuctEquipmentCoilParametersForm_Load(object sender, EventArgs e)
		{
			this.hytbName.Text = this.equipmentCoilSetDetailParas.Name;
			this.hytbLength.Text = this.equipmentCoilSetDetailParas.Length.ToString();
			this.hytbWidth.Text = this.equipmentCoilSetDetailParas.Width.ToString();
			this.hytbHigh.Text = this.equipmentCoilSetDetailParas.High.ToString();
			this.hytbCoolPower.Text = this.equipmentCoilSetDetailParas.CoolPower.ToString();
			this.hytbHotPower.Text = this.equipmentCoilSetDetailParas.HotPower.ToString();
			this.hytbWind.Text = this.equipmentCoilSetDetailParas.Wind.ToString();
			this.hytbWater.Text = this.equipmentCoilSetDetailParas.Water.ToString();
			this.hytbInDim.Text = this.equipmentCoilSetDetailParas.PipeInDim.ToString();
			this.hytbOutDim.Text = this.equipmentCoilSetDetailParas.PipeOutDim.ToString();
			this.hytbCoolDim.Text = this.equipmentCoilSetDetailParas.PipeCoolDim.ToString();
			this.hytbSupplyWidth.Text = this.equipmentCoilSetDetailParas.DuctSupplyWidth.ToString();
			this.hytbSupplyHigh.Text = this.equipmentCoilSetDetailParas.DuctSupplyHigh.ToString();
			this.hytbReturnWidth.Text = this.equipmentCoilSetDetailParas.DuctReturnWidth.ToString();
			this.hytbReturnHigh.Text = this.equipmentCoilSetDetailParas.DuctReturnHigh.ToString();
		}

		private void hytbName_TextChanged(object sender, EventArgs e)
		{
			this.i++;
			if (this.i > 16)
			{
				try
				{
					this.btnOK.Text = "修改";
					if (sender is YJKTextBox)
					{
						YJKTextBox hytextBox = sender as YJKTextBox;
						string name = hytextBox.Name;
						uint num = 0;//<PrivateImplementationDetails>.ComputeStringHash(name);
						if (num <= 2612169093u)
						{
							if (num <= 1980011732u)
							{
								if (num != 1322007172u)
								{
									if (num != 1537417086u)
									{
										if (num == 1980011732u)
										{
											if (name == "hytbLength")
											{
												this.equipmentCoilSetDetailParas.Length = double.Parse(hytextBox.Text);
											}
										}
									}
									else if (name == "hytbReturnHigh")
									{
										this.equipmentCoilSetDetailParas.DuctReturnHigh = double.Parse(hytextBox.Text);
									}
								}
								else if (name == "hytbWidth")
								{
									this.equipmentCoilSetDetailParas.Width = double.Parse(hytextBox.Text);
								}
							}
							else if (num <= 2393922538u)
							{
								if (num != 2299404932u)
								{
									if (num == 2393922538u)
									{
										if (name == "hytbOutDim")
										{
											this.equipmentCoilSetDetailParas.PipeOutDim = double.Parse(hytextBox.Text);
										}
									}
								}
								else if (name == "hytbHigh")
								{
									this.equipmentCoilSetDetailParas.High = double.Parse(hytextBox.Text);
								}
							}
							else if (num != 2453329901u)
							{
								if (num == 2612169093u)
								{
									if (name == "hytbCoolDim")
									{
										this.equipmentCoilSetDetailParas.PipeCoolDim = double.Parse(hytextBox.Text);
									}
								}
							}
							else if (name == "hytbSupplyWidth")
							{
								this.equipmentCoilSetDetailParas.DuctSupplyWidth = double.Parse(hytextBox.Text);
							}
						}
						else if (num <= 3235531356u)
						{
							if (num <= 3062605735u)
							{
								if (num != 2660986106u)
								{
									if (num == 3062605735u)
									{
										if (name == "hytbWater")
										{
											this.equipmentCoilSetDetailParas.Water = double.Parse(hytextBox.Text);
										}
									}
								}
								else if (name == "hytbCoolPower")
								{
									this.equipmentCoilSetDetailParas.CoolPower = double.Parse(hytextBox.Text);
								}
							}
							else if (num != 3168881483u)
							{
								if (num == 3235531356u)
								{
									if (name == "hytbHotPower")
									{
										this.equipmentCoilSetDetailParas.HotPower = double.Parse(hytextBox.Text);
									}
								}
							}
							else if (name == "hytbName")
							{
								this.equipmentCoilSetDetailParas.Name = hytextBox.Text;
							}
						}
						else if (num <= 3417078887u)
						{
							if (num != 3395812794u)
							{
								if (num == 3417078887u)
								{
									if (name == "hytbSupplyHigh")
									{
										this.equipmentCoilSetDetailParas.DuctSupplyHigh = double.Parse(hytextBox.Text);
									}
								}
							}
							else if (name == "hytbReturnWidth")
							{
								this.equipmentCoilSetDetailParas.DuctReturnWidth = double.Parse(hytextBox.Text);
							}
						}
						else if (num != 3583198950u)
						{
							if (num == 3921037799u)
							{
								if (name == "hytbInDim")
								{
									this.equipmentCoilSetDetailParas.PipeInDim = double.Parse(hytextBox.Text);
								}
							}
						}
						else if (name == "hytbWind")
						{
							this.equipmentCoilSetDetailParas.Wind = double.Parse(hytextBox.Text);
						}
					}
				}
				catch
				{
				}
			}
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			this.IsChangePara = true;
			base.Close();
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			if (this.btnOK.Text == "修改" && YJKMessageBox.Show("风机盘管数据已改变，是否保存？", MessageBoxButtons.YesNo) == DialogResult.Yes)
			{
				this.btnOK_Click(null, null);
				return;
			}
			this.IsChangePara = false;
			base.Close();
		}

		public EquipmentCoilSetDetailParas equipmentCoilSetDetailParas = new EquipmentCoilSetDetailParas();

		public bool IsChangePara;

		private int i = 1;
	}
}
